import { defHttp } from '/@/utils/http/axios';

enum Api {
  todoList = '/api-workflow/wf/processTask/todoList',
  doneList = '/api-workflow/wf/processTask/doneList',
  get = '/api-workflow/wf/processTask/detail',
  execute = '/api-workflow/wf/processTask/execute',
  jumpAbleTaskNameList = '/api-workflow/wf/processTask/jumpAbleTaskNameList',
  candidatePage = '/api-workflow/wf/processTask/candidatePage',
  surrogate = '/api-workflow/wf/processTask/surrogate',
  addCandidate = '/api-workflow/wf/processTask/addCandidate',
}

/**
 * 分页查询流程待办列表
 * @param params 查询参数
 * @returns
 */
export const todoList = (params) => defHttp.get({ url: Api.todoList, params });

/**
 * 分页查询流程已办列表
 * @param params 查询参数
 * @returns
 */
export const doneList = (params) => {
  return defHttp.get({ url: Api.doneList, params });
};

/**
 * 获取流程任务详情
 * @param params 查询参数
 * @returns
 */
export const getProcessTaskById = (params) => {
  return defHttp.get({ url: Api.get, params });
};

/**
 * 处理待办
 * @param params 查询参数
 * @returns
 */
export const executeProcessTask = (params) => {
  return defHttp.post({ url: Api.execute, params });
};

/**
 * 获取可跳转的任务节点名称
 * @param params 查询参数
 * @returns
 */
export const jumpAbleTaskNameList = (params) => {
  return defHttp.get({ url: Api.jumpAbleTaskNameList, params });
};

/**
 * 获取执行候选人
 * @param params 查询参数
 * @returns
 */
export const candidatePage = (params) => {
  return defHttp.get({ url: Api.candidatePage, params });
};

/**
 * 委托
 * @param params 查询参数
 * @returns
 */
export function surrogate(params) {
  return defHttp.post({ url: Api.surrogate, params });
}

/**
 * 加签
 * @param params 查询参数
 * @returns
 */
export function addCandidate(params) {
  return defHttp.post({ url: Api.addCandidate, params });
}
